<!DOCTYPE html>
<html>
	<head>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="format-detection" content="telephone=no" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>考勤登录</title>
		<link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
		<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
		<link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
		<link rel="stylesheet" type="text/css" href="../css/kaoqin/login.css"/>
		<style type="text/css">
			.btn{
				position: absolute;
				bottom: 20px;
				width: 90%;
				margin: 0 auto;
			}
			.num{
				margin-top: 50px;
			}
		</style>
	</head>
	<body>
		<div id="login">
			<mt-field class="num" label="学号" placeholder="请输入学号" type="number" v-model="number"></mt-field>
			<div class="Semester">
				职位：
				<input type="text" id="Semester" v-model="Semester" readonly onfocus="this.blur();">
			</div>
			<mt-button class="btn" @click="login()" type="primary">登录</mt-button>
		</div>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
		<script src="https://unpkg.com/mint-ui/lib/index.js"></script>
		<script type="text/javascript">
			var vm = new Vue({
				el:"#login",
				data:{
					number:"",
					Number:"",
					Semester:"请选择",
					zhiye:"12"
				},
				created:function(){
					
				},
				watch:{
					Number:function(New,Old){
						var _self = this;
						console.log(New);
						if(New == 0){
							_self.zhiye = 0;
						}else if(New == 1){
							_self.zhiye = 1;
						}
					}
				},
				methods:{
					login:function(){
						var _self = this;
						var num = _self.number;
						var zhiye = _self.zhiye;
						console.log(zhiye);
						if(num == ""){
							_self.$toast("请输入账号");
							return;
						}
						if(zhiye == "12"){
							console.log(zhiye)
							_self.$toast("请选择职位");
							return;
						}
						if(zhiye == 0){
							console.log(_self.zhiye);
							console.log(num);
							localStorage.setItem("number",num);
							location.href = "t_checking.html";
						}else if(zhiye == 1){
							console.log(num);
							localStorage.setItem("number",num);
							location.href = "checking_in.html"
						}
					}
				}
			})
			
			var Semester = document.getElementById("Semester");
				var isValu = [{
					label:"教师",
					value:0
				},{
					label:"学生",
					value:1
				}]
				Semester.addEventListener("click",function(event){
					weui.picker(isValu,{
						onChange:function(result){
							
						},
						onConfirm:function(result){
//							Semester.vlaue = isValu[parseInt(result)].label;
							vm.Semester = isValu[parseInt(result)].label;
							vm.$data.Number = result[0]
						}
					})
				},false)
		</script>
	</body>
</html>
